<?php
require_once '..'.DIRECTORY_SEPARATOR.'conf.php';
class GraphFactory
{
    private $_graphs=array();
    private static $_instance;
    
    private function __construct()
    {
        array_push($this->_graphs, "LineGraph");
    }
    
    public static function getInstance(){
        if(!self::$_instance){
            self::$_instance=new GraphFactory();
        }
        return self::$_instance;
    }
    
    public function getGraph($graphType,$height,$width,$config)
    {
        //ToDo: Check if graph exist. If not, throw error.
        
        //Assuming requested class is available here
        require_once $config['OS_PATH']."pgraph_".strtolower($graphType).".php";
        return new $graphType($height,$width,$config);
    }
}
//EOF: graphfactory.php